<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>Instagram Followers Counter Leaderboard ${year} | GugeeData</title>
	<meta name="description" content="This is the Instagram follower counter leaderboard for ${year}. | GugeeData">
	<meta name="keywords"
	      content="Instagram Followers Counter, Instagram Followers Counter live, Instagram Followers Count">
	<meta property="og:title" content="Instagram Followers Counter Leaderboard ${year} | GugeeData">
	<meta property="og:description" content="This is the Instagram follower counter leaderboard for ${year}. | GugeeData">
	<meta property="og:type" content="website">
	<meta property="og:url" content="https://www.gugeedata.com/instagram/follower-growth">
	<meta property="og:image" content=" https://seo-imags.s3.us-east-2.amazonaws.com/Logo.png">
	<meta name="twitter:title" content="Instagram Followers Counter Leaderboard ${year} | GugeeData">
	<meta name="twitter:description" content="This is the Instagram follower counter leaderboard for ${year}. | GugeeData">

	<link rel="icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>

	<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@500&display=swap" rel="stylesheet">
	<link rel="stylesheet" href="${request.contextPath}/static/plugins/layui/layui.css">
	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/common.css">
	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/rank.css">
    <#include "../../component/facebookPixel.ftl">
</head>
<body>
<#include "../../header_new1.ftl">
<main>
	<section>
		<div class="container">
			<h1>Instagram Follower Growth Leaderboard ${year}</h1>
			<h2>This is the Instagram follower growth count leaderboard for ${year}</h2>
			<div class="rank-tab">
				<div class="tab-list">
					<div class="tab-item">
						<a href="/instagram/rank-influencers">Comprehensive Influential Leaderboard</a>
					</div>
					<div class="tab-item is-active">Follower Growth Leaderboard</div>
					<div class="tab-item">
						<a href="/instagram/rank-commercial-partner">Commercial Partner Leaderboard</a>
					</div>
				</div>
			</div>
			<div class="gd-select rank-tab-select">
				<div class="gd-select-title">
					<div class="label">Follower Growth Leaderboard</div>
					<i class="iconfont icondown1"></i>
				</div>
				<div class="gd-select-wrap" style="display: none;">
					<ul>
						<li class="gd-option" onclick="toRank()">Comprehensive Influential Leaderboard</li>
						<li class="gd-option is-active">Follower Growth Leaderboard</li>
						<li class="gd-option" onclick="toParter()">Commercial Partner Leaderboard</li>
					</ul>
				</div>
			</div>
		</div>
	</section>
	<section>
		<div class="container is-pc">
			<div class="export-row">
				<div class="gd-btn-group">
					<div class="gd-btn is-active">Daily</div>
					<div class="gd-btn">Weekly</div>
<#--					<div class="gd-btn">Monthly</div>-->
				</div>
				<div class="gd-select">
					<div class="gd-select-title">
						<div class="label"></div>
						<i class="iconfont icondown1"></i>
					</div>
					<div class="gd-select-wrap">
						<ul id="dateDayList"></ul>
						<ul id="dateWeekList" style="display: none"></ul>
						<ul id="dateMonthList" style="display: none"></ul>
					</div>
				</div>
				<button class="gd-btn btn-info" onclick="exportRank()">Export</button>
				<#setting datetime_format="MM-dd-yyyy HH:mm"/>
				<div class="flex-right">Data Updated： ${updateTime?number_to_datetime} UTC</div>
			</div>
			<div class="search-row">
				<div class="search-item">
					<div class="label">Categories :</div>
					<div class="search-wrap">
						<ul id="categoryList">
							<li class="is-active">All</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="tab-wrap">
				<table class="ins-table">
					<thead>
					<tr>
						<th align="left">Rank</th>
						<th align="left">Influencer</th>
						<th>Followers</th>
						<th>Follower Growth</th>
						<th>Action</th>
					</tr>
					</thead>
					<tbody>
					<#if listData.list?size gt 0>
                        <#list listData.list as item>
							<tr>
								<td class="td-inx">
									<div class="td-inx__inner">
										<div class="tb-inx">${item.rank}</div>
										<div class="inx-status">
                                            <#if item.rankGrowCount lt 0>
												<span class="rank-down">↓ ${item.rankGrowCount*-1}</span>
                                            <#elseif item.rankGrowCount == 0>
												-
                                            <#else>
                                                <#if item.rankGrowCount gt 1000>
	                                                <img class="rank-new" src="/static/img/ins/NEW.svg" alt="new">
                                                <#else>
													<span class="rank-up">↑ ${item.rankGrowCount}</span>
                                                </#if>
                                            </#if>
										</div>
									</div>
								</td>
								<td class="tb-user">
									<div class="avatar">
                                        <#assign picUrl=myController.getNoExpiredImage(item.picUrl,0,0)>
										<img src="${picUrl}" alt="${item.fullName!''}">
                                        <#if item.isVerified == true>
											<img class="avatar__affix" src="/static/img/ins/Authentication.png"/>
                                        </#if>
									</div>
									<div class="label">
										<div class="title">
											${item.username}
											<#if item.secondCategory??>
												<div class="limit-tx">${item.secondCategory}</div>
											<#elseif item.categoryName??>
												<div class="limit-tx">${item.categoryName}</div>
											</#if>
										</div >
										<div class="sub-title">${item.fullName}</div>
									</div>
								</td>
                                <#if item.followerCount??>
                                    <#assign followerCount=myController.getNumber(item.followerCount)>
									<td>${followerCount}</td>
                                <#else>
									<td>0</td>
                                </#if>
                                <#if item.followerGrow??>
                                    <#assign followerGrow=myController.getNumber(item.followerGrow)>
									<td>${followerGrow}</td>
                                <#else>
									<td>0</td>
                                </#if>
								<td>
									<div class="td-action">
										<div class="gd-popover" content="Analyze">
											<div class="blue">
												<a href="/instagram/influencer/${item.username}" target="_blank">
													<i class="iconfont iconxiangqing"></i>
												</a>
											</div>
										</div>
									</div>
								</td>
							</tr>
                        </#list>
                    <#else>
	                    <tr>
		                    <td colspan="7">
			                    <div class="no-data">
				                    <img width="131" height="131" src="/static/img/ins/noData.png" alt="">
				                    <div class="title">No related data available</div>
			                    </div>
		                    </td>
	                    </tr>
					</#if>
					</tbody>
					<#--<tfoot>
					<tr>
						<td colspan="8">
							<a href="javascript:;" onclick="toLogin()">
								<span>View More</span>
							</a>
						</td>
					</tr>
					</tfoot>-->
				</table>
			</div>
			<div class="pagination" id="pagination"></div>
		</div>
		<div class="container is-mobile">
			<div class="sort-list">
				<div class="sort-item" onclick="showFilter(0)">
					Daily
					<i class="iconfont icondown1"></i>
				</div>
                <div class="sort-item" onclick="showFilter(1)">
					<i class="iconfont icondown1"></i>
				</div>
				<div class="sort-item" onclick="showFilter(2)">
					Categories
					<i class="iconfont icondown1"></i>
				</div>
			</div>
			<div class="filter-wrap" onclick="hideFilter()">
				<div class="filter-wrap__inner">
					<div class="sort-list">
						<div class="sort-item" onclick="showFilter(0)">
							Daily
							<i class="iconfont icondown1"></i>
						</div>
						<div class="sort-item" onclick="showFilter(1)">
							<i class="iconfont icondown1"></i>
						</div>
						<div class="sort-item" onclick="showFilter(2)">
							Categories
							<i class="iconfont icondown1"></i>
						</div>
					</div>
					<ul id="sortDateType" style="display: none">
						<li style="display: block; padding: 0">
							<div class="gd-btn-select">
								<ul class="btn-select">
									<li class="btn-select-item is-active" value="1">Daily</li>
									<li class="btn-select-item" value="2" >Weekly</li>
									<li class="btn-select-item" value="3" style="display: none">Monthly</li>
								</ul>
							</div>
						</li>
					</ul>
					<ul id="sortDateDay" style="display: none"></ul>
					<ul id="sortDateWeek" style="display: none"></ul>
					<ul id="sortDateMonth" style="display: none"></ul>
					<ul id="sortCategory" style="display: none"></ul>
				</div>
			</div>
			<div class="gd-mobile-list">
				<div class="gd-mobile-list__wrap">
					<#if listData.list?size gt 0 >
                        <#list listData.list as item>
							<a href="/instagram/influencer/${item.username}">
								<div class="user-item">
									<div class="user-info">
										<div class="avatar">
                                            <#assign picUrl=myController.getNoExpiredImage(item.picUrl,0,0)>
											<img class="head" src="${picUrl}" alt="${item.fullName!''}">
                                            <#if item.isVerified == true>
												<img class="icon" width="16" height="16"
												     src="/static/img/ins/Authentication.png"
												     srcset="/static/img/ins/Authentication@2x.png 2x" alt="">
                                            </#if>
										</div>
										<div class="user-title">
											<div class="top">
												<div class="nickname">${item.fullName}</div>
                                                <#--<svg title="${item.nation}" class="icon icon-country" aria-hidden="true">
													<use xlink:href="#icon_${item.nation}"></use>
												</svg>-->
												<#if item.secondCategory??>
													<div class="category">
														${item.secondCategory}
													</div>
												<#elseif item.categoryName??>
													<div class="category">
														${item.categoryName}
													</div>
												</#if>
											</div>
											<div class="bottom">
                                                ${item.username}
											</div>
										</div>
										<div class="user-rank">
                                            ${item.rank}
											<div class="user-rank-change">
                                                <#if item.rankGrowCount lt 0>
													<span class="rank-down">↓ ${item.rankGrowCount*-1}</span>
                                                <#elseif item.rankGrowCount == 0>
													-
                                                <#else>
                                                    <#if item.rankGrowCount gt 1000>
	                                                    <img class="rank-new" src="/static/img/ins/NEW.svg" alt="new" />
                                                    <#else>
														<span class="rank-up">↑ ${item.rankGrowCount}</span>
                                                    </#if>
                                                </#if>
											</div>
										</div>
									</div>
									<div class="user-data">
										<div class="data-item">
											<div class="label">Followers</div>
                                            <#if item.followerCount??>
                                                <#assign followerCount=myController.getNumber(item.followerCount)>
												<div class="num">${followerCount}</div>
                                            <#else>
												<div class="num">0</div>
                                            </#if>
										</div>
										<div class="data-item">
											<div class="label">Follower Growth</div>
                                            <#if item.followerGrow??>
                                                <#assign followerGrow=myController.getNumber(item.followerGrow)>
												<div class="num">${followerGrow}</div>
                                            <#else>
												<div class="num">0</div>
                                            </#if>
										</div>
									</div>
								</div>
							</a>
                        </#list>
					<#else>
						<div class="no-data">
							<img width="131" height="131" src="/static/img/ins/noData.png"
						                          alt="no data"
						                          srcset="/static/img/ins/noData@2x.png 2x, /static/img/ins/noData@3x.png 3x">
							<div class="title">No related data available</div>
						</div>
					</#if>
				</div>
				<div class="gd-mobile-list__footer">
                    <#if login != false>
						<div class="rotate"><i class="iconfont icongengxin"></i></div>
						<span class="list-footer-tx" style="display: none">You have reached the end.</span>
                    <#else>
						<a href="javascript:;" onclick="toLogin()">
							View More
						</a>
                    </#if>
				</div>
			</div>
		</div>
	</section>
	<#if login == false>
		<section class="section-seo">
			<div class="seo-wrap">
				<div class="seo-item">
					<i class="iconfont iconuser-search-line-16px"></i>
					Instagram Followers Counter
				</div>
				<div class="seo-item">
					<i class="iconfont iconuser-location-line-16px"></i>
					Instagram Followers Counter Live
				</div>
				<div class="seo-item">
					<i class="iconfont iconuser-location-line-16px"></i>
					Instagram Followers Count
				</div>
				<div class="seo-item">
					<i class="iconfont iconmap-pin-user-line-16px"></i>
					Followers Count on Instagram
				</div>
			</div>
		</section>
	</#if>
</main>
<#if isMobile == false>
    <#include "../../footer_new.ftl">
	<script src="${request.contextPath}/static/plugins/layui/layui.js" charset="utf-8"></script>
</#if>
<#--<script src="//at.alicdn.com/t/font_1880456_j3yvm9k8lh.js"></script>-->
<script src="${request.contextPath}/static/js/gd-ui/button/group.js"></script>
<script src="${request.contextPath}/static/js/nums.js"></script>
<script src="${request.contextPath}/static/js/scroll.js"></script>
<script src="${request.contextPath}/static/js/list/common.js"></script>
<script>
    const params = {
        pageSize: 10,
        page: 1,
		rankType: 1
    }
    let fgDate = {}

	/** mobile **/
	let dateType = 0

    <#if isMobile == true>
		<#if login == true>
		let scrollTimer
		let hasData = true
		window.addEventListener('scroll', () => {
			if (!hasData) {
				return
			}
			if (parseInt((getScrollTop() + getWindowHeight() + 200)) >= getScrollHeight()) {
				if (scrollTimer) {
					clearTimeout(scrollTimer)
				}
				scrollTimer = setTimeout(() => {
					const list_len = document.querySelectorAll('.gd-mobile-list__wrap > a').length
					if (list_len >= params.page * 10) {
						params.page++
						getMobileRankList()
					}
				}, 500)
			} else {
				if (scrollTimer) {
					clearTimeout(scrollTimer)
				}
			}
		})
		</#if>
    <#else>
        let totalRow = +${listData.totalRow?c}
    </#if>

	function initEvent() {
    	/** pc **/
		const dateDayList = document.getElementById('dateDayList')
		const dateWeekList = document.getElementById('dateWeekList')
		const dateMonthList = document.getElementById('dateMonthList')
		const label = document.querySelector('.export-row .gd-select .label')
		document.querySelectorAll('.gd-btn-group .gd-btn').forEach((item, i) => {
			item.addEventListener('click', e => {
				<#if login == false>
				toLogin()
				return false
				</#if>
				params['rankType'] = i + 1
				if(i === 0) {
					visitRecord(17)
					if(fgDate.dailyDate.length > 0) {
						params['date'] = fgDate.dailyDate[0].dateCode
						label.innerText = fgDate.dailyDate[0].dateDesc
					} else {
						label.innerText = ''
						params['date'] = undefined
					}
					dateDayList.show()
					dateWeekList.hide()
					dateMonthList.hide()
				} else if(i === 1) {
					visitRecord(18)
					if(fgDate.weeklyDate.length > 0) {
						params['date'] = fgDate.weeklyDate[0].dateCode
						label.innerText = fgDate.weeklyDate[0].dateDesc
					} else {
						label.innerText = ''
						params['date'] = undefined
					}
					dateDayList.hide()
					dateWeekList.show()
					dateMonthList.hide()
				} else {
					visitRecord(19)
					if(fgDate.monthlyDate.length > 0) {
						params['date'] = fgDate.monthlyDate[0].dateCode
						label.innerText = fgDate.monthlyDate[0].dateDesc
					} else {
						label.innerText = ''
						params['date'] = undefined
					}
					dateDayList.hide()
					dateWeekList.hide()
					dateMonthList.show()
				}
                params['page'] = 1
				getRankList()
			})
		})
		/** mobile **/
		document.querySelector('.filter-wrap__inner').addEventListener('click', e => {
			e.stopPropagation()
		})
		document.querySelectorAll('.gd-btn-select .btn-select-item').forEach(item => {
			item.addEventListener('click', e => {
				if(!e.target.classList.contains('is-active')) {
					params.page = 1
					e.target.parentElement.querySelector('.is-active').classList.remove('is-active')
					e.target.classList.add('is-active')
					const ranType = +e.target.getAttribute('value')
					if(params['rankType'] !== ranType) {
						let str = ''
						let dateName = ''
						params['rankType'] = ranType
						if(ranType === 1) {
							visitRecord(17)
							dateName = 'Daily'
							if(fgDate.dailyDate.length > 0) {
								params['date'] = fgDate.dailyDate[0].dateCode
								str = fgDate.dailyDate[0].dateDesc + '<i class="iconfont icondown1"></i>'
							} else {
								params['date'] = ''
							}
						} else if(ranType === 2) {
							visitRecord(18)
							dateName = 'Weekly'
							if(fgDate.weeklyDate.length > 0) {
								params['date'] = fgDate.weeklyDate[0].dateCode
								str = fgDate.weeklyDate[0].dateDesc + '<i class="iconfont icondown1"></i>'
							} else {
								params['date'] = ''
							}
						} else {
							visitRecord(19)
							dateName = 'Monthly'
							if(fgDate.monthlyDate.length > 0) {
								params['date'] = fgDate.monthlyDate[0].dateCode
								str = fgDate.monthlyDate[0].dateDesc + '<i class="iconfont icondown1"></i>'
							} else {
								params['date'] = ''
							}
						}
						document.querySelectorAll('.sort-list .sort-item:nth-child(1)').forEach(item => {
							item.innerHTML = dateName + '<i class="iconfont icondown1"></i>'
						})
						document.querySelectorAll('.sort-list .sort-item:nth-child(2)').forEach(item => {
							item.innerHTML = str
						})
					}
					hideFilter()
					getMobileRankList()
				}
			})
		})
	}

    function showFilter (type) {
		<#if login == false>
		toLogin()
		return false
		</#if>
        document.body.style.overflow = 'hidden'
        document.body.style.position = 'fixed'
	    const filterWrap = document.querySelector('.filter-wrap')
        filterWrap.style.top = getScroll().top + 60 + 'px'
        filterWrap.show()
		document.querySelectorAll('.filter-wrap__inner > ul').forEach(item => {
			item.hide()
		})
        const sortDateType = document.getElementById('sortDateType')
        const sortCategory = document.getElementById('sortCategory')
        if(type === 0) {
			sortDateType.show()
        } else if(type === 1) {
			if(params['rankType'] === 1) {
				document.getElementById('sortDateDay').show()
			} else if(dateType === 2) {
				document.getElementById('sortDateWeek').show()
			} else {
				document.getElementById('sortDateMonth').show()
			}
		} else {
			sortCategory.show()
        }
    }
    function hideFilter() {
        document.body.style.overflow = 'auto'
        document.body.style.position = 'initial'
        document.querySelector('.filter-wrap').hide()
    }

    function initPagination() {
        layui.use('laypage', function () {
            let laypage = layui.laypage;
            //执行一个laypage实例
            laypage.render({
                elem: 'pagination', //注意，这里的 test1 是 ID，不用加 # 号
                count: totalRow, //数据总数，从服务端得到
                prev: '<i class="iconfont iconicon_previous"></i>',
                next: '<i class="iconfont iconarrowright"></i>',
                jump: (obj, first) => {
                    if (!first) {
                        <#if login == false>
                        toLogin()
                        return false
                        </#if>
                        params.page = obj.curr
                        getRankList()
                    }
                }
            })
        })
    }
	function toRank() {
		window.location.href = '/instagram/rank-influencers'
	}
    function toParter() {
        window.location.href='/instagram/rank-commercial-partner'
    }
    function getRankList() {
        if(params['categoryName'] === 'All') {
            params['categoryName'] = ''
        }
        let url = getEncodeUrl('/ins/fg/rank', params)
        let tableBody = document.querySelector('.ins-table tbody')
        tableBody.showLoading()

        getList(tableBody, url, list => {
            let str = ''
            list.forEach(item => {
                str += '<tr>' +
                    '<td class="td-inx">' +
                    '<div class="td-inx__inner">' +
                    '<div class="tb-inx">' + item.rank + '</div>' +
                    '<div class="inx-status">'
                if(item.rankGrowCount < 0) {
                    str += '<span class="rank-down">↓ ' + item.rankGrowCount*-1 + '</span>'
                } else if(item.rankGrowCount === 0) {
                    str += '-'
                } else {
                    if(item.rankGrowCount > 1000) {
                        str += '<img class="rank-new" src="/static/img/ins/NEW.svg" alt="new">'
                    } else {
                        str += '<span class="rank-up">↑ ' + item.rankGrowCount + '</span>'
                    }
                }
                str += '</div>' +
                    '</div>' +
                    '</td>' +
                    '<td class="tb-user">' +
                    '<div class="avatar">' +
                    '<img src="' + getImage(item.picUrl, IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                if(item.isVerified) {
                    str += '<img class="avatar__affix" src="/static/img/ins/Authentication.png" />'
                }
                str += '</div>' +
                    '<div class="label">' +
                    '<div class="title">' + item.username
                if(item.secondCategory) {
                    str += '<div class="limit-tx">' + item.secondCategory + '</div>'
                } else if (item.categoryName) {
					str += '<div class="limit-tx">' + item.categoryName + '</div>'
				}
                str +='</div>' +
                    '<div class="sub-title">' + item.fullName +'</div>' +
                    '</div>' +
                    '</td>' +
                    ' <td>' + numFormat(+item.followerCount) + '</td>' +
                    ' <td>' + numFormat(+item.followerGrow) + '</td>'+
                    '<td>' +
                    '<div class="td-action">' +
                    '<div class="gd-popover" content="Analyze">' +
                    '<div class="blue">' +
                    '<a href="/instagram/influencer/' + item.username + '" target="_blank">' +
                    '<i class="iconfont iconxiangqing"></i>' +
                    '</a>' +
                    '</div>' +
                    '</div>' +
                    '</div>' +
                    '</td>' +
                    '</tr>'
            })
            return str
        })
    }

    function getMobileRankList() {
        let url = getEncodeUrl('/ins/fg/rank', params)
		const wrap = document.querySelector('.gd-mobile-list__wrap')
		wrap.showLoading()

        getList(wrap, url, list => {
            let str = ''
            list.forEach(item => {
                str += '<a href="/instagram/influencer/' + item.username + '">' +
                    '<div class="user-item">' +
                    '<div class="user-info">' +
                    '<div class="avatar">' +
                    '<img class="head" src="' + getImage(item.picUrl, IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                if(item.isVerified) {
                    str += '<img class="icon" width="16" height="16" src="/static/img/ins/Authentication.png" srcset="${request.contextPath}/static/img/ins/Authentication@2x.png 2x" alt="">'
                }
                str += '</div>' +
                    '<div class="user-title">' +
                    '<div class="top">' +
                    '<div class="nickname">' + item.fullName + '</div>'
                // '<svg title="' + item.nation + '" class="icon icon-country" aria-hidden="true">' +
                // '<use xlink:href="#icon_' + item.nation + '"></use>' +
                // '</svg>' +
                if(item.secondCategory) {
                    str += '<div class="category">' + item.secondCategory + '</div>'
                } else if (item.categoryName) {
					str += '<div class="category">' + item.categoryName + '</div>'
				}
                str += '</div>' +
                    '<div class="bottom">' + item.username +
                    '</div>' +
                    '</div>' +
                    '<div class="user-rank">' + item.rank +
                    '<div class="user-rank-change">'
                if(item.rankGrowCount < 0) {
                    str += '<span class="rank-down">↓ ' + item.rankGrowCount*-1 + '</span>'
                } else if(item.rankGrowCount === 0) {
                    str += '-'
                } else {
                    if(item.rankGrowCount > 1000) {
                        str += '<img class="rank-new" src="/static/img/ins/NEW.svg" alt="new" />'
                    } else {
                        str += '<span class="rank-up">↑ ' + item.rankGrowCount + '</span>'
                    }
                }
                str += '</div>' +
                    '</div>' +
                    '</div>' +
                    '<div class="user-data">' +
                    '<div class="data-item">' +
                    '<div class="label">Followers</div>' +
                    '<div class="num">' + numFormat(+item.followerCount) +'</div>' +
                    '</div>' +
                    '<div class="data-item">' +
                    '<div class="label">Follower Growth</div>' +
                    '<div class="num">' + numFormat(+item.followerGrow) + '</div>' +
                    '</div>' +
                    '</div>' +
                    '</div>' +
                    '</a>'
            })
            return str
        })
    }

    function exportRank() {
    	<#if login == false>
    		toLogin()
			return false
    	</#if>
		visitRecord(20)
        let url = getEncodeUrl('/ins/fg/export', params)
        window.open(url)
    }

	function getDate() {
		return _axios.get('/ins/fg/date')
	}
    function getCategory() {
        return _axios.get('/ins/dic/overall/category')
    }
</script>
<script type="module">
    import { Select } from '/static/js/gd-ui/select/index.es.js'
    initRank()
    function initRank() {
        initOption()
        initEvent()
        <#if isMobile == false>
        initPagination()
        </#if>
    }

    function initOption() {
        Promise.all([getCategory(), getDate()]).then(res => {
            let str = ''
            if (res[0].Code === 200) {
                <#if isMobile == false>
                const categoryList = document.getElementById('categoryList')
                str = '<li class="is-active" value="All">All</li>'
                res[0].Data.forEach(item => {
                    str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                })
                categoryList.innerHTML = str
                <#else>
                const sortCategory = document.getElementById('sortCategory')
                str = '<li class="is-active" value="">All<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                res[0].Data.forEach(item => {
                    str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                })
                sortCategory.innerHTML = str
                </#if>
            }

            if (res[1].Code === 200) {
                fgDate = res[1].Data
                str = ''
                <#if isMobile == false>
                const dateDayList = document.getElementById('dateDayList')
                res[1].Data.dailyDate.forEach((item, i) => {
                    str += '<li value="' + item.dateCode + '"'
                    if(i === 0) {
                        str += ' class="is-active">' + item.dateDesc + '</li>'
                        dateDayList.parentElement.parentElement.querySelector('.label').innerText = item.dateDesc
                        params.date = item.dateCode
                    } else {
                        str += '>' + item.dateDesc + '</li>'
                    }
                })
                dateDayList.innerHTML = str
                const dateWeekList = document.getElementById('dateWeekList')
                str = ''
                res[1].Data.weeklyDate.forEach((item,i) => {
                    str += '<li value="' + item.dateCode + '"'
                    if(i === 0) {
						str += ' class="is-active">' + item.dateDesc + '</li>'
                    } else {
						str += '>' + item.dateDesc + '</li>'
                    }
                })
                dateWeekList.innerHTML = str

                const dateMonthList = document.getElementById('dateMonthList')
                str = ''
                res[1].Data.monthlyDate.forEach((item, i) => {
                    str += '<li value="' + item.dateCode + '"'
                    if(i === 0) {
                        str += ' class="is-active">' + item.dateDesc + '</li>'
                    } else {
						str += '>' + item.dateDesc + '</li>'
                    }
                })
                dateMonthList.innerHTML = str

				let gdSelect = new Select()
				gdSelect.setElement(document.querySelectorAll('.export-row .gd-select'))
                <#if login == false>
                gdSelect.setBeforeSelectEvent(e => {
                    toLogin()
	                return false
                })
                </#if>
                gdSelect.setSelectedEvent(e => {
                    const value = e.target.getAttribute('value')
                    params.page = 1
                    params.date = value
                    getRankList()
                })
                gdSelect.init()
                <#else>
                const sortDateDay = document.getElementById('sortDateDay')
                res[1].Data.dailyDate.forEach((item, i) => {
                    if(i === 0) {
                        let title = item.dateDesc + '<i class="iconfont icondown1"></i>'
                        document.querySelectorAll('.is-mobile .sort-list .sort-item:nth-child(2)').forEach(item => {
                            item.innerHTML = title
                        })
                        params['date'] = item.dateCode
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '" class="is-active">' +
                            item.dateDesc + '<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                    } else {
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '">' + item.dateDesc + '</li>'
                    }
                })
                sortDateDay.innerHTML = str
                const sortDateWeek = document.getElementById('sortDateWeek')
                str = ''
                res[1].Data.weeklyDate.forEach((item, i) => {
                    if(i === 0) {
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '" class="is-active">' +
                            item.dateDesc + '<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                    } else {
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '">' + item.dateDesc + '</li>'
                    }
                })
                sortDateWeek.innerHTML = str
                const sortDateMonth = document.getElementById('sortDateMonth')
                str = ''
                res[1].Data.monthlyDate.forEach((item, i) => {
                    if(i === 0) {
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '" class="is-active">' +
                            item.dateDesc + '<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                    } else {
                        str += '<li data-label="' + item.dateDesc + '" value="' + item.dateCode + '">' + item.dateDesc + '</li>'
                    }
                })
                sortDateMonth.innerHTML = str
				let gdMobileSelect = new Select()
	            <#if login == false>
                gdMobileSelect.setBeforeSelectEvent(e => {
                    if(e.target.classList.contains('rank-tab-select')) {
                        return true
                    }
                    toLogin()
                    return false
                })
	            </#if>
				gdMobileSelect.init()
                </#if>

            }
            document.querySelectorAll('.search-wrap li').forEach(item => {
                item.addEventListener('click', e => {
                    <#if login == false>
                    toLogin()
                    return false
                    </#if>
                    if(!e.target.classList.contains('is-active')) {
                        const ul = e.target.parentElement
                        ul.querySelector('.is-active').classList.remove('is-active')
                        e.target.classList.add('is-active')
                        params.page = 1
                        params.categoryName = e.target.getAttribute('value')
                        getRankList()
                    }
                })
            })
            document.querySelectorAll('.filter-wrap__inner>ul>li').forEach(item => {
                item.addEventListener('click', e => {
                    if(!e.target.classList.contains('is-active')) {
                        params.page = 1
                        const ul = e.target.parentElement
                        const value = e.target.getAttribute('value')
                        const oldActive = ul.querySelector('.is-active')
                        oldActive.classList.remove('is-active')
                        e.target.classList.add('is-active')
                        oldActive.innerHTML = oldActive.innerText
                        if(ul.id === 'sortCategory') {
                            params.categoryName = value
                            let inner = (value?value:'All') + '<div class="right"><i class="iconfont iconzhichi"></i></div>'
                            e.target.innerHTML = inner
                            document.querySelectorAll('.sort-list .sort-item:nth-child(3)').forEach(sortItem => {
                                sortItem.innerHTML = value + '<i class="iconfont icondown1"></i>'
                            })
                        } else {
                            params.date = value
                            e.target.innerHTML = e.target.getAttribute('data-label') + '<div class="right"> <i class="iconfont iconzhichi"></i></div>'
                            document.querySelectorAll('.sort-list .sort-item:nth-child(2)').forEach(sortItem => {
                                sortItem.innerHTML = e.target.getAttribute('data-label') + '<i class="iconfont icondown1"></i>'
                            })
                        }
                        hideFilter()
                        getMobileRankList()
                    }
                })
            })
        }).catch(err => {
            console.error(err)
        })
    }
</script>
</body>
</html>